package com.sinosoft.dsp.persistence.businessconcept.atom;

import javax.measure.unit.Unit;

import com.sinosoft.dsp.persistence.businessconcept.utils.UnitHelper;
import com.sinosoft.dsp.system.utils.Const;

/**
 * 方位对象
 * 
 * @author 潘巍（Peter Pan）
 * @since 2011-4-23 下午03:53:19
 */
public class SinoDirectionBean implements ISinoAtomType {
	// 方位代码
	private String code;

	// 数字
	private Double num;

	// 单位
	private Unit<?> unit;

	public String getCode() {
		return code;
	}

	public SinoDirectionBean setCode(String code) {
		this.code = code;
		return this;
	}

	public Double getNum() {
		return num;
	}

	public SinoDirectionBean setNum(Double num) {
		this.num = num;
		return this;
	}

	public Unit<?> getUnit() {
		return unit;
	}

	public SinoDirectionBean setUnit(Unit<?> unit) {
		this.unit = unit;
		return this;
	}

	public String getUnitName() {
		return UnitHelper.getUnitName(unit);
	}

	public SinoDirectionBean setUnit(String unitName) {
		this.unit = UnitHelper.getUnit(unitName);
		return this;
	}

	@Override
	public boolean isEmpty() {
		return (this.num == null && Const.isEmpty(this.code));
	}

}
